class Solution {//leetcode1863——找出所有子集的异或总和
private:
    void _dfs(vector<int>&nums,int pos){
        int sum=0;
        for(auto e:path){
            sum^=e;
        }
        ret+=sum;
        int n=nums.size();
        if(pos==n) return;
        for(int i=pos;i<n;i++){
            path.push_back(nums[i]);
            _dfs(nums,i+1);
            path.pop_back();
        }
    }
public:
    int subsetXORSum(vector<int>& nums) {
        _dfs(nums,0);
        return ret;
    }
private:
    int ret=0;//异或总和
    vector<int> path;
};